package com.youjiang.dao.impl;

import com.youjiang.dao.SubjectMapper;
import com.youjiang.dao.entity.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by yujia on 2017/11/15.
 */
@Service
public class SubjectDaoImpl {
    @Autowired
    private SubjectMapper subjectMapper;

    public void insert(){
        Subject subject = new Subject();
        String str = "一级科目22ss";
        subject.setSubL1(str);
        subject.setSubL2(str);
        int i = subjectMapper.insert(subject);
        System.out.println(i);
    }

    public Subject query(){

        Subject subject =  subjectMapper.selectByPrimaryKey(1);
        if(null != subject){
            System.out.println(subject.getSubL1());
            System.out.println(subject.getSubL2());
        }
        return subject;
    }

}
